<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2010. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="../../book.css" charset="ISO-8859-1" type="text/css">
<title>Breakpoint Enable Condition</title>
</head>
<body>
<h1>Breakpoint Enable Condition</h1>
<p>Select the <strong>Conditional</strong> option to enable the ability to provide a custom condition for the breakpoint. </p>
<p>Each breakpoint can have a unique condition that determines when the breakpoint will be hit.</p>
<p>A condition for a breakpoint can be any logical expression that evaluates to either true or false.
  The expression is evaluated in the scope of the breakpoint location, meaning you cannot make reference to a class, etc., outside the scope of the breakpoint
  location when composing your expression. </p>
<p>Consider the following example:</p>
<pre>public class Person {

	String name = "";
	int age = 0;

	public Person(String name, int age) {
		this.name = name;
		this.age = age;		//breakpoint here
  }
};</pre>
<p>If we take the above example, place a breakpoint where indicated and go to the breakpoint properties we can add our condition. In this case we are limited only to the members of the class the breakpoint is contained in and those provided by Object.</p>
<p>For example a valid condition could be:</p>
<pre>	age == 56 </pre>
<p>meaning the breakpoint would only suspend when age was equal to 56.</p>
<p>Conditions can be added to breakpoints in the <a href="../../reference/views/breakpoints/ref-breakpoints_view.htm#detail_pane"><strong>Breakpoints View</strong></a> detail pane or with the <a href="../../reference/views/breakpoints/ref-properties_contextaction.htm"><strong>Breakpoints Properties...</strong></a> shown below. </p>
<p><img src="images/ref-breakpoint_condition.PNG" alt="Breakpoint condition option"></p>
<p>&nbsp;</p>
<h3 class="related">Related Concepts</h3>
  <a href="../../concepts/cbrkpnts.htm">Breakpoints</a>

<h3 class="related">Related Tasks</h3>
  <a href="../../tasks/task-add_line_breakpoints.htm">Adding breakpoints</a><br>
  <a href="../../tasks/task-remove_line_breakpoints.htm">Removing breakpoints</a><br>
  <a href="../../tasks/task-launching_java_program.htm">Launching a Java program</a><br>
  <a href="../../tasks/task-running_and_debugging.htm">Running and debugging</a>

<h3 class="related">Related References</h3>
  <a href="../../reference/breakpoints/ref-enabled_option.htm">Enabled Option </a><br>
  <a href="../../reference/breakpoints/ref-hitcount_option.htm">Hit Count</a><br>
  <a href="../../reference/breakpoints/ref-suspendpolicy_option.htm">Suspend Policy </a><br>
  <a href="../../reference/breakpoints/ref-entry_option.htm">Method Entry</a><br>
  <a href="../../reference/breakpoints/ref-exit_option.htm">Method Exit</a>
</body>
</html>
